package com.mc.nginxrtmpdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.Switch;

import org.screenshare.rtmp.android.nginx.service.NginxUtils;
import org.screenshare.rtmp.nginx.Nginx;

import java.util.concurrent.ExecutorService;

/**
 * Desc: 主界面
 *
 * @author Zach
 * created at 2022/9/15 17:41
 */
public class MainActivity extends AppCompatActivity {

    private Nginx nginx;
    private Switch switchRad;
    private Context mContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        setContentView(R.layout.activity_main);
        switchRad = findViewById(R.id.sw);
        switchRad.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    nginx.start();
//                    NginxUtils.startNginx(mContext);
                }
                //else {
//                    NginxUtils.stopNginx(mContext);
                // }
            }
        });
        nginx = Nginx.create();
    }
}
